package com.jzo2o.customer.controller.operation;

import com.jzo2o.common.model.PageResult;
import com.jzo2o.customer.model.domain.AgencyCertificationAudit;
import com.jzo2o.customer.model.dto.request.AgencyCertificationAuditPageQueryReqDTO;
import com.jzo2o.customer.model.dto.request.CertificationAuditReqDTO;
import com.jzo2o.customer.model.dto.response.AgencyCertificationAuditResDTO;
import com.jzo2o.customer.service.IAgencyCertificationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author xd
 */
@RestController
@Api(tags = "运营端 - 机构认证审核相关接口")
@RequestMapping("/operation/agency-certification-audit")
public class AgencyCertificationAuditController {
    @Resource
    private IAgencyCertificationService agencyCertificationService;

    /**
     * @author xd
     * 审核机构认证分页查询
     * @param dto 分页条件实体类
     * @return 分页结果包装类
     */
    @ApiOperation("审核机构认证分页查询")
    @GetMapping("/page")
    public PageResult<AgencyCertificationAuditResDTO> page(AgencyCertificationAuditPageQueryReqDTO dto) {
        return agencyCertificationService.pageQuery(dto);
    }

    /**
     * @author xd
     * 审核机构认证信息
     * @param dto {@code CertificationAuditReqDTO} 包装认证状态和驳回原因
     * @param id {@code Long} 认证申请信息id
     */
    @PutMapping("/audit/{id}")
    @ApiOperation("审核机构认证信息")
    public void audit(@RequestBody CertificationAuditReqDTO dto, @PathVariable("id") Long id){
        agencyCertificationService.audit(dto,id);
    }
}
